package jeons.admin.product.biz.impl;

import java.util.List;


import jeons.admin.product.biz.ProductBiz;
import jeons.admin.product.dto.ProductDTO;
import jeons.admin.product.dto.ProductSerchDTO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ProductBizImpl extends SqlMapClientDaoSupport implements ProductBiz{
	@Autowired SqlMapClientTemplate sqlMapClientTemplate;

	@Override
	public ProductDTO getData(String type) {
		return (ProductDTO) sqlMapClientTemplate.queryForObject("Product.getData", type);
	}

	@SuppressWarnings("unchecked")
	public List<ProductDTO> getTypeList(String type) {
		return (List<ProductDTO>) sqlMapClientTemplate.queryForList("Product.getTypeList", type);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ProductDTO> getSerchTypeList(ProductSerchDTO productSerchDTO) {
		return (List<ProductDTO>) sqlMapClientTemplate.queryForList("Product.getSerchTypeList", productSerchDTO);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ProductDTO> getTypeListPage(ProductDTO productDTO) {
		return (List<ProductDTO>) sqlMapClientTemplate.queryForList("Product.getTypeListTest", productDTO);
	}

	@Override
	public int getCount(String type) {
		return (int) sqlMapClientTemplate.queryForObject("Product.getTypeCount",type);
				
				
				
	}

	@Override
	public void updateData(ProductDTO productDTO) {
		 sqlMapClientTemplate.update("Product.updateData",productDTO);;
	}


	

}
